package Project2;

public class SavingsAccount extends Account {
 
/*
 * This function delcares a new Savings Account
 */
	public SavingsAccount(String NewName, String NewAccount, String NewPhone, String NewSSN, double NewBeginBalance)
	{
		Name = NewName;
		Account = NewAccount;
		Phone = NewPhone;
		SSN = NewSSN;
		BeginBalance = NewBeginBalance;
		Type = "Savings";
	}
	
	/*
	 * This function calculates the interest of a Savings Account
	 * (non-Javadoc)
	 * @see Project2.Account#CalcInt()
	 */
	public void CalcInt()
	{
		//There are different interest rates based on the Account Balance
		if (BeginBalance < 5000)
		{
			double Interest = (4.0/100);
			NewBalance = BeginBalance + (BeginBalance * Interest);
		}
		else
		{
			double InterestRate = (5.0/100);
			InterestGained = (BeginBalance * InterestRate);
			NewBalance = BeginBalance + (BeginBalance * InterestRate);
		}
	}
}
